<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>抓取所有剩余的结果</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="memcached.fetch.html">« Memcached::fetch</a></li>
      <li style="float: right;"><a href="memcached.flush.html">Memcached::flush »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.memcached.html">Memcached</a></li>
    <li>抓取所有剩余的结果</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="memcached.fetchall" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Memcached::fetchAll</h1>
  <p class="verinfo">(PECL memcached &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Memcached::fetchAll</span> &mdash; <span class="dc-title">抓取所有剩余的结果</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-memcached.fetchall-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Memcached::fetchAll</strong></span>(): <span class="type">array</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>Memcached::fetchAll()</strong></span>抓取最后一次请求的结果集中剩余的所有结果。需要注意的是fetchAll和fetch的返回不同，
   因为fetchAll抓取的是结果集中剩余所有元素， 所以比fetch的结果多一个维度。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-memcached.fetchall-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-memcached.fetchall-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回结果集 或者在失败时返回 <strong><code>false</code></strong>.
   如需要则使用 <span class="methodname"><a href="memcached.getresultcode.html" class="methodname">Memcached::getResultCode()</a></span>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-memcached.fetchall-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4388">
    <p><strong>示例 #1 <span class="function"><a href="memcached.getdelayed.html" class="function">Memcached::getDelayed()</a></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Memcached</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addServer</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">11211</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'int'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">99</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'string'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'a&nbsp;simple&nbsp;string'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'array'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">11</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//延迟抓取int和array两个key的值<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDelayed</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'int'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'array'</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//抓取上面delay抓取的所有结果<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetchAll</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(2) {
  [0]=&gt;
  array(3) {
    [&quot;key&quot;]=&gt;
    string(3) &quot;int&quot;
    [&quot;value&quot;]=&gt;
    int(99)
    [&quot;cas&quot;]=&gt;
    float(2363)
  }
  [1]=&gt;
  array(3) {
    [&quot;key&quot;]=&gt;
    string(5) &quot;array&quot;
    [&quot;value&quot;]=&gt;
    array(2) {
      [0]=&gt;
      int(11)
      [1]=&gt;
      int(12)
    }
    [&quot;cas&quot;]=&gt;
    float(2365)
  }
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-memcached.fetchall-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="memcached.fetch.html" class="methodname" rel="rdfs-seeAlso">Memcached::fetch()</a> - 抓取下一个结果</span></li>
    <li class="member"><span class="methodname"><a href="memcached.getdelayed.html" class="methodname" rel="rdfs-seeAlso">Memcached::getDelayed()</a> - 请求多个元素</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>